<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<%@ taglib prefix="sd" uri="/struts-dojo-tags" %>
<!DOCTYPE html>
<html lang="en">
<head>
<s:head theme="xhtml"/>
<sd:head debug="true" locale="zh" parseContent="true" extraLocales="en-us,zh-cn,de-de"/>
<meta charset="utf-8">
<title>创建订单——订单管理——鑫四合珠宝管理</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="huyuzhu">
<!-- Le styles -->
<link href="${pageContext.request.contextPath}/css/bootstrap.css" rel="stylesheet" type="text/css">
<link href="${pageContext.request.contextPath}/css/base.css" rel="stylesheet">
<link href="${pageContext.request.contextPath}/css/main.css" rel="stylesheet">
<!-- HTML5 shim, for IE6-8 support of HTML5 elements -->
<!--[if lt IE 9]>
      <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/js/bootstrap-affix.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/js/jquery.placeholder.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/js/bootstrap-modal.js"></script>
<script type="text/javascript">
$(document).ready(function(){
		$("#showbt").live("click",function(){
		$(".hidekuanhao").show();
		});
		$("#showbt02").live("click",function(){
		$(".hidekuanhao").hide();
		});
});

$(document).ready(function(){ 
	$('#customer').change(function(){ 
		var customerinfo = $("#customerinfo").html();	
		var selected = $(this).children('option:selected').val();
		$("#customerid").val(selected);
		if(selected==0){
			$("#orderName").val("");
			$("#sealWords").val("");
		}
		var list = new Array();
		list = customerinfo.split(";");
		for(var i=0;i<list.length-1;i++){
			 var customer = list[i];
			 var temp = new Array();
			 temp = customer.split(":");
			 if($.trim(temp[0])==selected){
				 $("#orderName").val(temp[1]);
				 $("#sealWords").val(temp[2]);
				 break;
			 }
		}
	}); 
	}); 
</script>
</head>
<body>
<!-- 头部 -->
<s:include value="../header.jsp"/>
<div class="hide" id="customerinfo">
	<s:iterator value="customerList"><s:property value="customerid"/>:<s:property value="orderName"/>:<s:property value="sealWords"/>;</s:iterator>
</div>
<!-- 主内容区开始 -->
<div class="conBox clearfix">
<s:if test="#session.UserInfo.userVO.userType==1">
<s:include value="../a/menu.jsp">
	<s:param name="menuIndex" value="3"/>
</s:include>
</s:if>
<s:else>
<s:include value="menu.jsp">
	<s:param name="menuIndex" value="3"/>
</s:include>
</s:else>
  <div class="mainBox">
    <h1>创建订单</h1>
    <s:form id="AddForm" action="addingUser" cssClass="form-horizontal">
    <div class="control-group">
        <label class="control-label" for="ID">订单号：</label>
        <div class="controls">
        <s:textfield name="order.orderid" disabled="true" id="orderid"/><s:hidden name="order.orderid"/>
        </div>
      </div>
	  <div class="control-group">
        <label class="control-label" for="ID">客户名：</label>
        <div class="controls">
          <s:select id="customer" name="materialStone.customerid" list="customerList" listKey="customerid" 
           listValue="customerName" headerKey="" headerValue="请选择客户名"/>
        </div>
      </div>
	   <div class="control-group">
        <label class="control-label" for="ID">下单名：</label>
        <div class="controls">
          <s:textfield id="orderName" name="order.orderName"/>
        </div>
      </div>
	 <div class="control-group">
        <label class="control-label" for="ID">客户号：</label>
        <div class="controls">
          <s:textfield id="customerid" name="order.customerid"/>
        </div>
      </div>
	   <div class="control-group">
        <label class="control-label" for="ID">字印：</label>
        <div class="controls">
           <s:textfield id="sealWords" name="order.sealWords"/>
        </div>
      </div>
	  <div class="control-group">
        <label class="control-label" for="ID">成色：</label>
        <div class="controls">
          <s:select cssClass="span2" name="order.materialType" list="materialTypeList" listKey="attrName" listValue="attrName"/>
        </div>
      </div>
	  <div class="control-group">
        <label class="control-label" for="ID">金价：</label>
        <div class="controls">
          <s:textfield name="order.materialPrice" id="materialPrice"/>
        </div>
      </div>
	  <div class="control-group">
        <label class="control-label" for="ID">预计交付时间：</label>
        <div class="controls">
          <sd:datetimepicker name="user.deliveryDate" displayFormat="yyyy-MM-dd hh:mm:ss" startDate="today" id="deliveryDate" formatLength="full"/>
        </div>
      </div>
	 <div class="control-group">
        <label class="control-label" for="ID">备注：</label>
        <div class="controls">
          <s:textarea name="orders.remark" cssClass="input-xlarge" id="Remark" rows="5"/>
        </div>
      </div>
      <button class="btn" type="button" style="margin-top:10px;" data-toggle="modal" data-target="#addkuanxiang"><i class="icon-plus"></i> 新增款项</button>
      <table class="table table-bordered table-hover">
        <thead>
        <tr>
          <th>序号</th>
          <th>模号</th>
          <th>图片</th>
          <th>名称</th>
          <th>手寸</th>
          <th>件数</th>
          <th>总金重</th>
          <th>主石总数</th>
          <th>副石总数</th>
          <th>加工费</th>
        </tr>
        </thead>
        <tbody>
        <tr>
          <td>1</td>
          <td><a href="template_detailed_02.html">JZ_001</a></td>
          <td><img src="img/pic01.jpg" alt="JZ_001"></td>
          <td>女戒</td>
          <td>12</td>
          <td>100</td>
          <td>462.00</td>
          <td>100</td>
          <td>200</td>
          <td></td>
        </tr>
        </tbody>
      </table>
      
      <table class="table table-bordered">
        <tr>
          <td class="goldbg">款数：</td>
          <td class="w180">1</td>
          <td class="goldbg">总件数：</td>
          <td>120</td>
        </tr>
        <tr>
          <td class="goldbg">主石总数：</td>
          <td class="w180">20</td>
          <td class="goldbg">副石总数：</td>
          <td>120</td>
        </tr>
        <tr>
          <td class="goldbg">总金重：</td>
          <td class="w180">685.20</td>
          <td class="goldbg">总金价：</td>
          <td></td>
        </tr>
        <tr>
          <td class="goldbg">加工费：</td>
          <td class="w180"></td>
          <td class="goldbg">总记：</td>
          <td></td>
        </tr>
        <tr>
          <td class="goldbg">订单备注：</td>
          <td class="w180"></td>
          <td class="goldbg">经手人：</td>
          <td>何总</td>
        </tr>
      </table>
      
      <div class="bottom_btnBox">
        <button type="button" class="btn btn-large btn-primary" data-toggle="modal" data-target="#myModal">提 交</button>
      </div>
    </s:form>
    </div>
</div>
<!-- 主内容区结束 --> 
<!-- 尾部 -->
<footer class="copyBox">©2012-2013 鑫四合珠宝</footer>

<div class="modal hide fade" id="myModal">
  <div class="modal-header">
    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
    <h3>添加成功</h3>
  </div>
  <div class="modal-body">
    <p>添加成功！！你可以继续添加...</p>
  </div>
  <div class="modal-footer">
    <a href="#" class="btn btn-primary" data-dismiss="modal">确定</a>
  </div>
</div>
<script type="text/javascript">
function getTemplate(){	
	alert("OK");
	var param = $("#newCode").val();
	$.ajax({
	  type: "POST",
	  datatype:"text",
	  url: "${pageContext.request.contextPath}/o/getQueryTemplate.do",
	  data:{"template.newCode":param},
	  success:function(data){
	  	if(data=="error"){
	  		$("#TipMsg").html("未获取到相关数据,请重新输入查询提交!");
	  	}else{
	  		var templates = msg.split(";");
	  		alert(templats[0]);
	  		for(var i=0;i<templates-1;i++){
	  			var ss = new Array();
	  			ss = templates[i].split(":");
	  			$("#showTemplate").append("<li><div><img src='"+ ss[2] +"'></div><input type='checkbox'>"+ ss[1] +"</li>");
	  		}
	  		$("#templateSelect").modal('show');
	  	}
	});
</script>
<div class="modal hide fade" id="addkuanxiang">
  <div class="modal-header" >
    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
    <h3>新增款项</h3>
  </div>
  <div class="modal-body" style="padding-top:0px;">
    <p>
      <table class="table table-bordered">
        <tr>
          <td class="garybg">请输入款号：</td>
          <td><s:textfield id="newCode" name="template.newCode"/><span id="TipMsg error"></span></td>
        </tr>
        <tr>
          <td class="garybg">请输入款号名：</td>
          <td><s:textfield id="newCode" name="template.newCode"/><button onclick="getTemplate();" type="button" class="btn" id="showbt">查询</button></td>
        </tr>
        <tr>
          <td class="garybg">图片：</td>
          <td></td>
        </tr>
        <tr>
          <td class="garybg">名称：</td>
          <td></td>
        </tr>
        <tr>
          <td class="garybg">成色：</td>
          <td>Pt950</td>
        </tr>
        <tr>
          <td class="garybg">金重：</td>
          <td><input type="text"></td>
        </tr>
        <tr>
          <td class="garybg">手寸：</td>
          <td><input type="text"></td>
        </tr>
        <tr>
          <td class="garybg">件数：</td>
          <td><input type="text"></td>
        </tr>
        <tr>
          <td class="garybg">备注：</td>
          <td><input type="text"></td>
        </tr>
      </table>
      
    	<table class="table table-bordered table-hover">
              <caption>石料参数：</caption>
              <thead>
                <tr>
                  <th>属性</th>
                  <th>石料</th>
                  <th>数量</th>
                  <th>形状</th>
                  <th>重量</th>
                </tr>
              </thead>
              <tbody>
                <tr>
                  <td>主石</td>
                  <td>
                    <select class="w50">
                      <option>钻石</option>
                      <option>白玉</option>
                    </select>
                  </td>
                  <td><input type="text" class="w50"></td>
                  <td>
                    <select class="w50">
                      <option>蛋形</option>
                      <option>梨形</option>
                      <option>圆形</option>
                    </select>
                  </td>
                  <td><input type="text" class="w50"></td>
                </tr>
                <tr>
                  <td>副石1</td>
                  <td>
                    <select class="w50">
                      <option>钻石</option>
                      <option>白玉</option>
                    </select>
                  </td>
                  <td><input type="text" class="w50"></td>
                  <td>
                    <select class="w50">
                      <option>蛋形</option>
                      <option>梨形</option>
                      <option>圆形</option>
                    </select>
                  </td>
                  <td><input type="text" class="w50"></td>
                </tr>
                <tr>
                  <td>副石2</td>
                  <td>
                    <select class="w50">
                      <option>钻石</option>
                      <option>白玉</option>
                    </select>
                  </td>
                  <td><input type="text" class="w50"></td>
                  <td>
                    <select class="w50">
                      <option>蛋形</option>
                      <option>梨形</option>
                      <option>圆形</option>
                    </select>
                  </td>
                  <td><input type="text" class="w50"></td>
                </tr>
              </tbody>
        </table>
    </p>
  </div>
  <div class="modal-footer">
    <a href="#" class="btn btn-primary" data-dismiss="modal">确定</a>
  </div>
</div>

<div class="modal hide fade" id="templateSelect">
  <div class="modal-header" >
    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
    <h3>新增款项</h3>
  </div>
  <div class="modal-body" style="padding-top:0px;">
   <ul id="showTemplate" class="clearfix">
        <li>
          <div><img src="img/pic01.jpg" alt="JZ_001"></div>
          <input type="checkbox"> JZ00001戒指1号
        </li>
      </ul>
      <div class="bottom_btnBox"><a href="#" class="btn btn-primary" id="showbt02">提交</a></div>
</div>
</div>

</body>
</html>